﻿@{
    ViewBag.Title = "AdjPriceList";
}

@section scripts
{   
    <script src="@Url.Content("~/Scripts/shared/share.js")" type="text/javascript"></script> 
    <script src="@Url.Content("~/Scripts/shared/shown.js")" type="text/javascript"></script>
    <script src="@Url.Content("~/Scripts/Bill/Bill.js?ver=GetDate()")" type="text/javascript"></script>
    <script src="@Url.Content("~/Scripts/common/export.js")" type="text/javascript"></script> 
}
            @Html.Partial("~/Views/Modular/ReportsToolbar.cshtml")

        <table style="margin-bottom:4px;">
            <tr>
                <td  width ="80px" align="right">
                    <input id="comDateType" name="comDateType" class="mini-combobox" style="width:80px;"  data ="sDateType" value="2" />
                </td>
                <td width ="160px">  @Html.Partial("~/Views/Modular/dxDateRange.cshtml")
                </td>
                 <td align="right">调整类型：</td>
                <td >
                    <input id="AdjType" name="AdjType" class="mini-combobox" style="width:200px;" showNullItem="false"
                            allowInput="false" align="left" value ="0" data ="comAdjType"/> 
                </td>
               <td width ="80px" align="right">审核状态：</td>
                <td width ="160px">
                    <input id="FCheckFlag" name ="FCheckFlag" class="mini-combobox" style="width:150px;" value="0"
                    showNullItem="false" required="true" allowInput="false" align="left" data ="dCheckFlag"/>  
                </td>
            </tr>
            <tr>
                <td width ="80px" align="right">分店名称：</td>
                <td width ="190px">@Html.Partial("~/Views/Modular/LookupStockInfo.cshtml")</td>
                <td align="right">单据编号：</td>
                <td > <input name="FBillNo" class="mini-textbox" style="width:200px;"/> </td>
                <td align="right">商品名称：</td>
                <td ><input class="mini-textbox" width ="150px" id ="FSearchKey" name = "FSearchKey"/></td>
            </tr>
        </table>
<div class="mini-fit">
    <div id="datagrid1" class="mini-datagrid" style="width:100%;height:100%;" pageSize="15"
            borderStyle="border:1;" url="../Report/GetBillDetail"
            allowCellSelect="true" allowCellEdit="true"showColumnsMenu="true"fitColumns="false"  
            sortMode="client">
        <div property="columns">
            <div type="indexcolumn" width="40" headerAlign="center" >序号</div>
            <div field="FBillDate" name="FBillDate" width="80" headeralign="center" allowsort="true">单据日期</div>
            <div field="FBillNo" name="FBillNo" width="100" headeralign="center" allowsort="true">单号</div>
            <div field="FStarTime" name="FStarTime" width="130" headeralign="center" allowsort="true" dateFormat="yyyy-MM-dd HH:mm:ss">开始时间</div>
            <div field="FEndTime" name="FEndTime" width="130" headeralign="center" allowsort="true" dateFormat="yyyy-MM-dd HH:mm:ss">结束时间</div>
            <div field="FNumber" name="FNumber" width="100" headeralign="center" allowsort="true">商品编码</div>
            <div field="FName" name="FName" width="150" headeralign="center" allowsort="true">商品名称</div>
            <div field="FCode" name="FCode" width="100" headeralign="center" allowsort="true">商品条码</div>
            <div field="FPosPrice" name="FPosPrice" width="70" numberFormat="#,0.00" headerAlign="center" align="right" allowsort="true">零售价</div>
            <div field="mFNewPrice" name="mFNewPrice" width="70" numberFormat="#,0.00" headerAlign="center" align="right" allowsort="true">新零售价</div>
            <div field="FVipPrice" name="FVipPrice" width="70" numberFormat="#,0.00" headerAlign="center" align="right" allowsort="true">会员价</div>
            <div field="mFNewVipPrice" name="mFNewVipPrice" width="70" numberFormat="#,0.00" headerAlign="center" align="right" allowsort="true">新会员价</div>
            <div field="stockName" name="stockName" width="100" headeralign="center" allowsort="true">门店名称</div>
        </div>
    </div>
</div>
<script>
    var sDateType = [{ "id": "0", "text": "开始日期" },
                         { "id": "1", "text": "结束日期" },
                         { "id": "2", "text": "开单日期" }]

    var comAdjType = [{ "id": 0, "text": "全部" },
                    { "id": 13, "text": "零售调价" },
                   { "id": 14, "text": "会员调价" }]

    var dCheckFlag = [{ "id": "0", "text": "全部" },
                     { "id": "1", "text": "未审核" },
                     { "id": "2", "text": "已审核" }]

    mini.parse();

    function FormShown() {
        var toDay = new Date();
        mini.getbyName("FDate1").setValue(toDay);
        mini.getbyName("FDate2").setValue(toDay);
    }



    //加载资料列表
    function LoadListData() {
        var sSystemAppID = parent.window.getSystemAppID();
        var stockID = mini.getbyName("FStockID").getValue();
        var json = "[{";
        json = json + "'mListType':" + "'" + getQueryString("datatype") + "',";
        json = json + "'mSystemAppID':" + "'" + sSystemAppID + "',";
        json = json + "'mNumber':" + "'" + mini.getbyName("FSearchKey").getValue() + "',";
        json = json + "'mStockID':" + "'" + (stockID==""?"0":stockID) + "',";
        json = json + "'mBillType':" + "'" + mini.getbyName("AdjType").getValue() + "',";
        json = json + '"mDate1":' + '"' + mini.getbyName("FDate1").getFormValue() + '",';
        json = json + '"mDate2":' + '"' + mini.getbyName("FDate2").getFormValue() + '",';
        json = json + '"mDateType":' + '"' + mini.getbyName("comDateType").getValue() + '",';
        json = json + '"mBillNo":' + '"' + mini.getbyName("FBillNo").getValue() + '",';
        json = json + '"mCheckFlag":' + '"' + mini.getbyName("FCheckFlag").getValue() + '"';
        json = json + "}]";
        mExportDataJson = json;
        var grid = mini.get("datagrid1");
        grid.load({ mydata: json });
    }

    //搜索资料列表
    function LoadData() {
        LoadListData();
    }

    function dateToStr(datetime, htype) {
        if (datetime == null) datetime = new Date();
        var year = datetime.getFullYear();
        var month = datetime.getMonth() + 1; //js从0开始取 
        var date = datetime.getDate();
        if (month < 10) {
            month = "0" + month;
        }
        if (date < 10) {
            date = "0" + date;
        }
        if (htype == 1) {
            var time = year + "-" + month + "-" + date + " 00:00:01";
        }
        else {
            var time = year + "-" + month + "-" + date + " 23:59:59";
        }
        return time;
    }

    function clearloca() {
        var nowDate = new Date();
        mini.getbyName("FDate1").setValue(nowDate);
        mini.getbyName("FDate2").setValue(nowDate);
        mini.getbyName("comdatasel").setValue(0);
        mini.getbyName("AdjType").setValue(0);
        mini.getbyName("FCheckFlag").setValue(0);
        mini.getbyName("FStockID").setValue('');
        mini.getbyName("FStockID").setText(''); 
        mini.getbyName("FStockName").setText('');
        mini.getbyName("FBillNo").setText('');
        mini.getbyName("FSearchKey").setText('');
    }

    function printdata() {
        var grid = mini.get("datagrid1");
        var url = "../Report/PrintReport";
        mini.open({
            url: url,
            title: "打印", width: 1000, height: 700,
            onload: function () {
                var iframe = this.getIFrameEl();
                var NoneDisplayCol = [0];
                iframe.contentWindow.InitalPrint(grid, NoneDisplayCol, parent.window.getSystemCompany() + "调价明细表");
            }
        });
    }
</script>